﻿using System;
using System.Collections.Generic;

class MaximalSumOfElements
{

    static void Main()

    {
        Console.WriteLine("Enter N:");
        int numberN = int.Parse(Console.ReadLine());
        Console.WriteLine("Enter K:");
        int numberK = int.Parse(Console.ReadLine());
        int[] intArray = new int[numberN];
        for (int index = 0; index < numberN; index++)
        {
            Console.WriteLine("Enter element {0}", index);
            intArray[index] = int.Parse(Console.ReadLine());
        }
        Array.Sort(intArray);
        Console.WriteLine("The {0} numbers with best sum are:", numberK);
        for (int i = numberN - 1; i >= numberN - numberK; i--)
        {
            Console.WriteLine(intArray[i]);
        }
    }
}
